package cn.ivicar.iov.service.impl;

import cn.ivicar.iov.dao.IdentifyDao;
import cn.ivicar.iov.dao.VehicleDao;
import cn.ivicar.iov.service.IdentifyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @program: iov
 * @description: ${description}
 * @author: Mr.Wang
 * @create: 2018-08-13 16:11
 **/
@Service
public class IdentifyServiceImpl implements IdentifyService {

    @Autowired
    private IdentifyDao identifyDao;
    @Autowired
    private VehicleDao vehicleDao;

    @Override
    public String getIccid(String vehicle_serial) {
        return identifyDao.queryByVehicleId(vehicleDao.queryVehicleId(vehicle_serial));
    }

    @Override
    public void updateStatus(String vehicle_serial) {
       identifyDao.updateStatus(getIccid(vehicle_serial));
    }

    @Override
    public boolean IsIdentify(String vehicle_serial) {
        int status = identifyDao.queryStatusByVehicleId(vehicleDao.queryVehicleId(vehicle_serial));
        if (status == 1) {
            return true;
        } else {
            return false;
        }
    }
}
